<template>
    <div class="xxlSearchRoot">
        <div class="xxlCtx">
            <div class="xxlInput_box"><input :placeholder="placeholder" v-model="xxlSearch" class="xxlInput" type="text"></div>
            <div @click="xxlCommit()" class="xxlIcon xxlSearch">&#xeafe;</div>
        </div>
    </div>
</template>

<script>
export default {
    name: 'XxlSearch',

    data() {
        return {
            xxlSearch: ""
        };
    },
    props: {
        in: {
            default: ""
        },
        placeholder:{
            default:""
        }
    },
    mounted() {
        this.xxlSearch = this.in
    },
    watch: {
        xxlSearch(n, o) {
            if (n != o) {
                this.$emit('change', n);
            }
        },
        in(d) {
            this.xxlSearch = d
        }
    },
    methods: {
        xxlCommit() {
            this.$emit('search', this.xxlSearch);
        }
    },
};
</script>

<style lang="scss" scoped>
@import '../xxl-scss/xxl.scss';

@font-face {
    font-family: "search";
    /* Project id 4022609 */
    src: url('./iconfont.ttf?t=1681794627779') format('truetype');
}

.xxlSearch {
    font-family: "search" !important;
    font-size: 20px;
    font-style: normal;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.xxlCtx ,.xxlIcon{
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 15px;
}
.xxlCtx{
    background: $xxl-text-color-inverse;
}
.xxlCtx,.xxlIcon,.xxlInput_box {
    height: 30px;
    box-sizing: border-box;
}

.xxlInput_box {
    width: calc(100% - 70px);
    background: $xxl-text-color-inverse;
    // border: 1px 0px 1px 1px  solid $xxl-border-color;
    border-radius: 15px 0px 0px 15px;
}

.xxlInput {
    outline: none;
    height: 15px;
    border: 0px;
    margin: 3.5px 10px 3.5px 15px;
    font-size: 15px;
}
.xxlIcon{
    width: 70px;
    background: $xxl-color-click;
    color: $xxl-text-color-inverse;
}
</style>